#include<stdio.h>
#define N 200010

char str[N];
int may_ji,may_ou;
int f_num;
int n,max;

int main()
{
	char start;
	scanf("%d",&n);
	getchar();
	int res=0;
	for(int i=1;i<=n;i++)
	{
		int t_n=f_num;
		char t_c=start;
		scanf("%c",str+i);
		if(str[i]=='F')
		{
			f_num++;
		}
		else
		{
			f_num=0;
			if(str[i]=='B')
			{
				start=str[i];
			}
			else
			{
				start=str[i];
			}
		}
		if(i==1)
		{
			continue;
		}
		if(t_n+1==i&&str[i]!='F')
		{
			res=1;
			max+=t_n;
			may_ji+=t_n%2;
			may_ou+=t_n/2;
			continue;
		}
		else if(i==n&&str[i]=='F'&&t_n+1!=n)
		{
			res=1;
			max+=f_num;
			may_ji+=f_num%2;
			may_ou+=f_num/2;
			continue;
		}
		else if(t_n+1==n&&str[i]=='F')
		{
			printf("%d\n",n);
			for(int j=0;j<n;j++)
			{
				printf("%d\n",j);
			}
			return 0;
		}
		if(str[i]=='F')
		{
			continue;
		}
		else if(str[i]==str[i-1])
		{
			max++;
		}
		else if(str[i]!=str[i-1]&&str[i-1]!='F')
		{
			continue;
		}
		else if(str[i]!=str[i-1]&&str[i-1]=='F')
		{
			if(t_c==str[i])
			{
				max+=t_n+1;
				may_ou+=(t_n+1)/2;
			}
			else
			{
				max+=t_n;
				may_ou+=t_n/2;
			}
		}
	}
	int min=max-may_ji-(may_ou*2);
	if(may_ji==0&&res!=1)
	{
		printf("%d\n",may_ou+1);
		printf("%d\n",min);
		for(int i=0;i<may_ou;i++)
		{
			min+=2;
			printf("%d\n",min);
		}
	}
	else
	{
		printf("%d\n",max-min+1);
		printf("%d\n",min);
		for(int i=0;i<may_ji+(2*may_ou);i++)
		{
			printf("%d\n",++min);
		}
	}
	return 0;
} 


